<template>
    <div class="scroll-list-wrap" :style="{height: winHeight}">
        <cube-scroll ref="scroll" :options="options" @pulling-down="onPullingDown" @pulling-up="onPullingUp">
            <slot></slot>
        </cube-scroll>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                winHeight: null,
                options: {
                    pullDownRefresh: {
                        threshold: 90,
                        txt: '刷新成功'
                    },                                // 配置下拉刷新
                    pullUpLoad: {
                        threshold: 0,
                        txt: {
                            more: '上拉加载更多',
                            noMore: '没有更多数据'
                        }
                    }                                 // 配置上拉加载，若要关闭可直接 pullUpLoad：false
                },
            }
        },
        beforeCreate() {

        },
        create() {

        },
        methods:{
            loadData(){

            },
            // 触发下拉刷新
            onPullingDown(){
                console.log("下拉刷新");
                this.$refs.scroll.forceUpdate();
                this.$refs.scroll.refresh()
            },
            // 触发上拉加载
            onPullingUp() {
                console.log("上拉加载");
                this.$refs.scroll.forceUpdate();
                this.$refs.scroll.refresh()
            },
        },
        mounted(){
            // 挂载
            this.loadData();
            console.log(document.documentElement.clientHeight)
            this.winHeight = document.documentElement.clientHeight + 'px'
        },
    }
</script>

<style scoped type="text/stylus" lang="stylus">


</style>
